define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

    var Controller = {

        add: function () {

            // 初始化表格参数配置
            Table.api.init({
                search: true,
                advancedSearch: true,
                pagination: true,
                extend: {
                    "index_url": "user_follow/index?user_id="+Config.user_id,
                    "add_url": "",
                    "edit_url": "",
                    "del_url": "",
                    "multi_url": "",
                }
            });

            var table = $("#table");

            // 初始化表格
            table.bootstrapTable({
                url: $.fn.bootstrapTable.defaults.extend.index_url,
                columns: [
                    [

                        {checkbox: true},
                        {field: 'id', title: __('Id')},
                        // {field: 'user_id', title: __('User_id')},
                        // {field: 'user.username', title: __('User.username'), operate: 'LIKE'},
                        {field: 'memo', title: __('Memo'), operate: 'LIKE'},

                        // {field: 'office_id', title: __('Office_id')},
                        // {field: 'shop_id', title: __('Shop_id')},
                        // {field: 'store_id', title: __('Store_id')},
                        {field: 'branchofficeoffice.name', title: __('Branchofficeoffice.name'), operate: 'LIKE'},
                        {field: 'manystoreshop.name', title: __('Manystoreshop.name'), operate: 'LIKE'},
                        {field: 'manystore.username', title: __('Manystore.username'), operate: 'LIKE'},
                        // {field: 'updatetime', title: __('Updatetime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        {field: 'createtime', title: __('Createtime'), operate:'RANGE', addclass:'datetimerange', autocomplete:false, formatter: Table.api.formatter.datetime},
                        {field: 'operate', title: __('Operate'), table: table, events: Table.api.events.operate, formatter: Table.api.formatter.operate}




                    ]
                ],
                commonSearch: false
            });

            // 为表格绑定事件
            Table.api.bindevent(table);//当内容渲染完成后
            Controller.api.bindevent();

        },

        api: {
            bindevent: function () {
                Form.api.bindevent($("form[role=form]"));
            }
        }
    };
    return Controller;
});